package com.ruoyi.flow.auth.login;

import com.ruoyi.flow.auth.menu.Menu;
import com.ruoyi.flow.auth.menu.MenuReader;
import com.ruoyi.flow.auth.security.FlowUser;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @Author: wtian
 * @Description:
 * @Date: Created in 9:27 2018/8/6
 * @Version: 1.0
 */
@Controller
public class IndexController {
    @RequestMapping(value = "/index", method = RequestMethod.GET)
    public ModelAndView index(HttpServletRequest request) {
        ModelAndView mav = new ModelAndView("admin/index");
        FlowUser user = SecurityUtils.getCurrentActivitiAppUser();
        mav.addObject("user", user);
        List<Menu> menus = MenuReader.getInstance().getMenus();
        mav.addObject("menus", menus);
        return mav;
    }

    @RequestMapping(value = "/dashboard", method = RequestMethod.GET)
    public ModelAndView dashboard() {
        ModelAndView modelAndView = new ModelAndView("admin/dashboard");
        return modelAndView;
    }
}
